package com.baselibrary.libs.View.pullableview;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.ScrollView;

public class PullableScrollView extends ScrollView implements Pullable
{

	public PullableScrollView(Context context)
	{
		super(context);
	}

	public PullableScrollView(Context context, AttributeSet attrs)
	{
		super(context, attrs);
	}

	public PullableScrollView(Context context, AttributeSet attrs, int defStyle)
	{
		super(context, attrs, defStyle);
	}

	@Override
	public boolean canPullDown()
	{
		if (getScrollY() == 0)
			return true;
		else
			return false;
	}

	@Override
	public boolean canPullUp()
	{
		if (getScrollY() >= (getChildAt(0).getHeight() - getMeasuredHeight()))
			return true;
		else
			return false;
	}

//	@Override
//	public boolean dispatchTouchEvent(MotionEvent ev) {
//		switch (ev.getAction()){
//			case MotionEvent.ACTION_DOWN:
//				Log.i("PullableScrollView", "dispatchTouchEvent: 点到我了");
//				return true;
//			//break;
//			case MotionEvent.ACTION_MOVE:
//
//			break;
//			case MotionEvent.ACTION_UP:
//				Log.i("PullableScrollView", "dispatchTouchEvent: 我抬起来了");
//			break;
//		}
//
//		return super.dispatchTouchEvent(ev);
//
//	}


}
